﻿@using Abp.Application.Services.Dto
@using MyCompanyName.AbpZeroTemplate.Authorization
@using MyCompanyName.AbpZeroTemplate.Web.Areas.AppAreaName.Models.Roles
@using MyCompanyName.AbpZeroTemplate.Web.Areas.AppAreaName.Startup
@model RoleListViewModel
@{
    ViewBag.CurrentPageName = AppAreaNamePageNames.Common.Roles;
}

@section Scripts
    {
    <script abp-src="/view-resources/Areas/AppAreaName/Views/_Bundles/role-list.js" asp-append-version="true"></script>
}

<div class="kt-subheader kt-grid__item">
    <div class="kt-subheader__main">
        <h3 class="kt-subheader__title">
            <span>@L("Roles")</span>
        </h3>
        <span class="kt-subheader__separator kt-subheader__separator--v"></span>
        <span class="kt-subheader__desc">
            @L("RolesHeaderInfo")
        </span>
    </div>
    <div class="kt-subheader__toolbar">
        <div class="kt-subheader__wrapper">
            @if (IsGranted(AppPermissions.Pages_Administration_Roles_Create))
            {
                <button id="CreateNewRoleButton" class="btn btn-primary"><i class="la la-plus"></i> @L("CreateNewRole")</button>
            }
        </div>
    </div>
</div>

<div class="kt-content">
    <div class="kt-portlet kt-portlet--mobile">
        <div class="kt-portlet__body">
            <div class="kt-form">
                <div class="row mb-4">
                    <div class="col-xl-6">
                        <div class="form-group">
                            @Html.DropDownList(
                                "PermissionSelectionCombobox", Model.Permissions.Select(i => i.ToSelectListItem()),
                                new
                                {
                                    @class = "form-control selectpicker",
                                    data_live_search = "true",
                                    data_none_selected_text = L("FilterByPermission"),
                                    id = "PermissionSelectionCombo"
                                })
                        </div>
                    </div>
                    <div class="col-xl-6 text-right">
                        <button id="RefreshRolesButton" class="btn btn-primary"><i class="la la-refresh"></i> @L("Refresh")</button>
                    </div>
                </div>
            </div>
            <div class="align-items-center">
                <table id="RolesTable" class="display table table-striped table-bordered table-hover dt-responsive nowrap">
                    <thead>
                        <tr>
                            <th></th>
                            <th>@L("Actions")</th>
                            <th>@L("RoleName")</th>
                            <th>@L("CreationTime")</th>
                        </tr>
                    </thead>
                </table>
            </div>

        </div>
    </div>
</div>
